package com.example.lab.service.impl;

import com.example.lab.dao.ViewDao;
import com.example.lab.service.ViewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service("viewService")
public class ViewServiceImpl implements ViewService {
    @Resource
    ViewDao viewDao;
    @Override
    public List<List<String>> getView() {
        List<List<String>> countList=new ArrayList<>();
        List<Map<String, Object>> view = viewDao.getView();
        List<String> rowList=new ArrayList<>();
        rowList.add("product");
        rowList.add("实验室预约次数");
        countList.add(rowList);
        for (Map<String,Object> map: view) {
            List<String> areaTypeList=new ArrayList<>();
            areaTypeList.add(map.get("Rname").toString());
            areaTypeList.add(map.get("预约次数").toString());
            countList.add(areaTypeList);
        }
        return countList;
    }
}
